<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript" charset="utf-8" src="${ctx}/editor/kindeditor-min.js"></script>
<div>
	<form id="f_scenario" action="<c:url value='/admin/cases/scenario/save.do'/>" method="post">
		<input type="hidden" name="casesId" value="${casesId}">
		<input type="hidden" name="actionId" value="${actionId}">
		<input type="hidden" name="targetId" value="${targetId}">
		<input type="hidden" name="scenario.scenarioId" value="${scenario.scenarioId}">
		<table id="t_scenario_detail">
			<tr>
				<th width="75px">编码</th>
				<td>
					<input type="text" name="scenario.scenarioCode" value="${scenario.scenarioCode}" disabled="disabled"/>
				</td>
			</tr>
			<tr>
				<th width="75px">场景标题</th>
				<td>
					<input type="text" name="scenario.title" value="${scenario.title}"/>
				</td>
			</tr>
			<tr>
				<th width="75px">场景内容</th>
				<td>
					<textarea id="scenario_content" name="scenario.content" rows="150" cols="80" style="width:600px;height:300px"><c:out value='${scenario.content}'/></textarea>
				</td>
			</tr>
			<tr>
				<th width="75px"> 场景使用的图片路径</th>
				<td>
					<input type="text" name="scenario.image" value="${scenario.image}"/>
				</td>
			</tr>
			<tr>
				<th width="75px">场景的位置</th>
				<td>
					<select name="scenario.position">
						<option value="0" <c:if test="${scenario.position ==0}">selected="selected"</c:if>>中间</option>
						<option value="1" <c:if test="${scenario.position ==1}">selected="selected"</c:if>>开始</option>
						<option value="-1" <c:if test="${scenario.position ==-1}">selected="selected"</c:if>>结束</option>
					</select>
				</td>
			</tr>
			<tr>
				<th width="75px">是否是正确的结束</th>
				<td>
					<select name="scenario.answer">
						<option value="0" <c:if test="${scenario.answer ==0}">selected="selected"</c:if>>不是结束</option>
						<option value="1" <c:if test="${scenario.answer ==1}">selected="selected"</c:if>>正确</option>
						<option value="-1" <c:if test="${scenario.answer ==-1}">selected="selected"</c:if>>错误</option>
					</select>
				</td>
			</tr>
			<tr>
				<th width="75px">是否可用</th>
				<td>
					<input type="checkbox" id="f_scenario_enabled" name="scenario.enabled" value="1"/>
					<script type="text/javascript">
						var scenarioEnabled = "<c:out value='${scenario.enabled}' />";
						var scenarioEnabledValue = parseInt(scenarioEnabled);
						if(scenarioEnabledValue == 1){
							$("#f_scenario_enabled").attr("checked",true);
					  	}
					</script>
				</td>
			</tr>
			<tr>
				<td><input type="submit" name="保存" value="保存"/></td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
KE.show({
	id : 'scenario_content',
	imageUploadJson : ctx+'/h/keditor.do',
	fileManagerJson : ctx + '/editor/jsp/file_manager_json.jsp',
	allowFileManager : true,
	afterCreate : function(id) {
		KE.event.ctrl(document, 13, function() {
			KE.util.setData(id);
			document.forms['scenario_content'].submit();
		});
		KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
			KE.util.setData(id);
			document.forms['scenario_content'].submit();
		});
	}
});
</script>